import { baseUrlApi, requestClient, type Result } from '#/api/request';

/** 获取后台登录模式 */
export const getHasOauthLogin = () => {
  return requestClient.get<Result>(
    baseUrlApi('/plugin/wechat/api_index/hasOauthLogin'),
  );
};

/** 获取微信登录二维码的uuid */
export const getWechatQrUuid = () => {
  return requestClient.get<Result>(baseUrlApi('/plugin/wechat/index/QrUuid'));
};

//* * 轮询 */
export const postWechatCheckQrUuid = (data: object) => {
  return requestClient.post<Result>(
    baseUrlApi('/plugin/wechat/index/checkQrUuid'),
    data,
  );
};
/** 管理员列表 */
export const getThirdPartyUsers = (params?: object) => {
  return requestClient.get<Result>(
    baseUrlApi('/plugin/wechat/api_admin_index/index'),
    {
      params,
    },
  );
};

/** 微信消息模板列表 */
export const getMsgTemplate = (params?: object) => {
  return requestClient.get<Result>(
    baseUrlApi('/plugin/wechat/api_admin_template/index'),
    {
      params,
    },
  );
};

/** 微信用户列表 */
export const getUsers = (params?: object) => {
  return requestClient.get<Result>(
    baseUrlApi('/plugin/wechat/api_admin_user/index'),
    {
      params,
    },
  );
};

//* * 模板消息测试提交 */
export const postMsgTemplate = (data: object) => {
  return requestClient.post<Result>(
    baseUrlApi('/plugin/wechat/api_admin_template/indexPost'),
    data,
  );
};

//* * 模板消息测试 */
export const postMsgTemplateTest = (data: object) => {
  return requestClient.post<Result>(
    baseUrlApi('/plugin/wechat/api_admin_template/indexTest'),
    data,
  );
};

/**
 * 设置模板消息测试状态
 */
export const postMsgTemplateStatus = (data: object) => {
  return requestClient.post<Result>(
    baseUrlApi(`/plugin/wechat/api_admin_template/indexStatus`),
    data,
  );
};

/** 获取二维码的uuid */
export const getQrUuid = () => {
  return requestClient.get<Result>(
    baseUrlApi('/plugin/wechat/admin_index/QrUuid'),
  );
};

//* * 轮询 */
export const postCheckQrUuid = (data: object) => {
  return requestClient.post<Result>(
    baseUrlApi('/plugin/wechat/admin_index/checkQrUuid'),
    data,
  );
};
